package com.hichina.client;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by IntelliJ IDEA.
 * User: zigang.wang
 * Date: 12-2-29
 * Time: 上午9:59
 * To change this template use File | Settings | File Templates.
 */
public class Token {
    String accessToken;
    String refreshToken;
    long expireTime;

    public  Token(){

    }


    public Token(String accessToken, String refreshToken, long expireTime) {
        this.accessToken = accessToken;
        this.refreshToken = refreshToken;
        this.expireTime = expireTime;
    }
    public  Token(String jsonContent) throws JSONException {
        JSONObject jsonObject = new JSONObject(jsonContent);
        setAccessToken(jsonObject.getString("access_token"));
        setRefreshToken(jsonObject.getString("refresh_token"));
        setExpireTime(jsonObject.getLong("expires_in"));
    }


    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(long expireTime) {
        this.expireTime = expireTime;
    }
}
